import http from '@/api';
import { ADMIN_PREFIX_V2 } from '@/api/helper/prefix';
import qs from 'qs';
//创建物料
export const createMaterial = params => {
  return http.post(ADMIN_PREFIX_V2 + `/basic_material/create`, params);
};

//删除物料
export const deleteMaterial = params => {
  return http.post(ADMIN_PREFIX_V2 + `/basic_material/delete`, params);
};

//更新物料
export const updateMaterial = params => {
  return http.post(ADMIN_PREFIX_V2 + `/basic_material/update`, params);
};

//获取物料列表
export const getMaterialList = params => {
  return http.get(ADMIN_PREFIX_V2 + `/basic_material/list?${qs.stringify(params, { arrayFormat: 'repeat' })}`);
};

//修改物料状态
export const updateMaterialState = params => {
  return http.post(ADMIN_PREFIX_V2 + `/basic_material/update_status`, params);
};

//获取物料类别级联下拉框
export const getMaterialTypeCascade = params => {
  return http.get(ADMIN_PREFIX_V2 + `/basic_material_type/cascade`, params);
};

// 获取单条物料信息
export const getMaterialInfo = params => {
  return http.get(ADMIN_PREFIX_V2 + `/basic_material/info`, params);
};
